import LocalStorage from 'localstorage'

const cityLocalStorage = new LocalStorage('city') // create a localStorage命名空间

export const  mutations = {
  doChangeCity (state, cityName) {
    // store中的state只能被mutations改变
    
    state.city = cityName
    try {
      cityLocalStorage.put('city', {cityName}) // 持久化到localStorage
    } catch (e) {
      console.log('LocalStorage操作错误')
    }
    
  },
}